import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import {resolve} from 'path'
import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
import {VantResolver} from 'unplugin-vue-components/resolvers'
export default defineConfig({
  plugins: [
      vue(),
      //自动导入 Vant 的组件和组件样式
      AutoImport({
        resolvers:[VantResolver()]
      }),
      Components({
        resolvers:[VantResolver()]
      })
  ],
  resolve:{
    alias:{
      '@':resolve(__dirname,'./src'),
    }
  },
  css: {
    //css预处理
    preprocessorOptions: {
      scss: {
        /*
        引入var.scss全局预定义变量，
        如果引入多个文件，
        可以使用
        '@import "@/assets/scss/globalVariable1.scss";@import "@/assets/scss/globalVariable2.scss";'
        这种格式
         */
        additionalData: '@import "@/style/_globalVariable.scss";'
      }
    }
  },
})
